﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ERPStudio;
using System.Data.SqlClient;

namespace ResUma
{
    public partial class PerioadeSuspendareFrm : FrmRezumat
    {
        private int _idPersoane = -1;
        private String NumePersoana = String.Empty;
        public PerioadeSuspendareFrm(ModuleClass mc,int idp,String nume):base(mc)
        {
            _idPersoane = idp;
            NumePersoana = nume;
            InitializeComponent();

            workConnString = mc.workConnectionString;
            eSRPDataSet.PersoaneSuspCM.IDPersoanaColumn.DefaultValue = _idPersoane;
            eSRPDataSet.PersoaneSuspCM.DeLaDataColumn.DefaultValue = DateTime.Now;
            eSRPDataSet.PersoaneSuspCM.MotivSuspendareColumn.DefaultValue = 0; 
            Text = Text + " - " + NumePersoana;


            motivSuspendareSursaBindingSource.List.Add(new MotivSuspendareSursa("Concediu ingrijire copil", 0));
            motivSuspendareSursaBindingSource.List.Add(new MotivSuspendareSursa("Concediu fara salar", 1));
        }

        private void PerioadeSuspendareFrm_Load(object sender, EventArgs e)
        {
            AddBindingSource(pesoaneSuspCMBindingSource);
            this.listTableAdaptor.Add(pesoaneSuspCMTableAdapter.Adapter);

            this.pesoaneSuspCMTableAdapter.Connection = DeschideConexiune(workConnString);
            this.pesoaneSuspCMTableAdapter.FillByIDPersoana(this.eSRPDataSet.PersoaneSuspCM, _idPersoane);
            InchideConexiune(this.pesoaneSuspCMTableAdapter.Connection);

        }
    }

    [Serializable]
    public class MotivSuspendareSursa
    {
        public MotivSuspendareSursa(String nume, Int32 tag)
        {
            _Name = nume;
            _Tag = tag;
        }

        private String _Name = String.Empty;
        [System.ComponentModel.Bindable(true)]
        public String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                _Name = value;
            }
        }
        private Int32 _Tag = 0;
        [System.ComponentModel.Bindable(true)]
        public Int32 Tag
        {
            get
            {
                return _Tag;
            }
            set
            {
                _Tag = value;
            }
        }

    }

}
